Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Right-Align  a  Single  Column  in  a  Word  Table  

 Content of Right-Align a Single Column in a Word Table.js
MD5 Hash: 285A1F82AD260084BE62AD539D8CFB3C
var wdalignparagraphright = 2;
var number_of_rows = 1;
var number_of_columns = 3;

var objword = new ActiveXObject("word.application");
objword.visible = true;
var objdoc = objword.documents.add();

var objrange = objdoc.range();
objdoc.tables.add (objrange, number_of_rows, number_of_columns);
var objtable = objdoc.tables(1);

x=2;

objtable.cell(1, 1).range.text = "process name";
objtable.cell(1, 2).range.text = "process id";
objtable.cell(1, 3).range.text = "handle count";

strcomputer = ".";
var objwmiservice = GetObject("winmgmts:\\\\" + strcomputer + "\\root\\cimv2");
var colitems = objwmiservice.execquery("select * from win32_process");
var myJS_Enumerator_1 = new Enumerator(colitems);
for (;!myJS_Enumerator_1.atEnd();myJS_Enumerator_1.moveNext()) {
objitem = myJS_Enumerator_1.item();
if (x > 1) {
objtable.rows.add();
}
objtable.cell(x, 1).range.text = objitem.name;
objtable.cell(x, 2).range.text = objitem.processid;
objtable.cell(x, 3).range.text = objitem.handlecount;
x = x + 1;
}

objdoc.tables(1).columns(3).select();
var objselection = objword.selection;

objselection.paragraphformat.alignment = wdalignparagraphright;



   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a